<%@ page contentType="text/html; charset=utf-8"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-tiles.tld" prefix="tiles"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/conf/tld/struts-bean.tld" prefix="bean"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="ipb" uri="/WEB-INF/conf/tld/ipb.tld"%>
<%@ taglib prefix="ad" uri="agiledata"%>
<%
String path = request.getContextPath();
%>
<link href="<%=path%>/css/style.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/newstyle.css" rel="stylesheet" type="text/css" />
<link href="<%=path%>/css/common.css" rel="stylesheet" type="text/css" />
<script language=javascript src="<%=path%>/js/vnv/commonForManage.js"></script>
<script language=javascript src="<%=path%>/js/popcalendar.js"></script>
<script language="javascript">
function doSearch(){
	var beginDateObj = getObj('beginDate');
	if (beginDateObj.value!="") {
		if (!checkDateInput(beginDateObj)) {
			return;
		}
	}
	
	var endDateObj = getObj('endDate');
	if (endDateObj.value!="") {
		if (!checkDateInput(endDateObj)) {
			return;
		}
		if (beginDateObj.value!="") {
			if (compareDate(beginDateObj.value, endDateObj.value)<0) {
				alert("起始日期不能大于结束日期！");
				return;
			}
		}
	}
	document.AccountQueryBean.action = "<%=path%>/page/transaction/gateWayTransQuery.do";
    document.AccountQueryBean.submit();
}
function viewTransList(){
	var checkValue = '';
	var aa = document.getElementsByName("viewDetail");
    for (var i=0; i<aa.length; i++)
    {
     	if(aa[i].checked){
    		checkValue=aa[i].value;
  		}
    }
    if (checkValue == '') {
    	alert('请选择一条栏目!');
    	return;
    }
	document.AccountQueryBean.action = "<%=path%>/page/transaction/gateWayTransList.do";
	document.AccountQueryBean.submit();
}

function doExport(){
	var beginDateObj = getObj('beginDate');
	if (beginDateObj.value!="") {
		if (!checkDateInput(beginDateObj)) {
			return;
		}
	}
	
	var endDateObj = getObj('endDate');
	if (endDateObj.value!="") {
		if (!checkDateInput(endDateObj)) {
			return;
		}
		if (beginDateObj.value!="") {
			if (compareDate(beginDateObj.value, endDateObj.value)<0) {
				alert("起始日期不能大于结束日期！");
				return;
			}
		}
	}
	document.AccountQueryBean.action = "<%=path%>/page/transaction/exportGateWayTrans.action";
    document.AccountQueryBean.submit();
}
</script>
<div id="main">
	<div class="content_right">
		<div style="width:745px;margin-left:10px;">
			<div class="titleinfo">
				银行结算查询
			</div>
			<div class="edit_pass">
				<html:form action="gateWayTransQuery" method="post">
					<table width="100%" border="0" align="center" cellpadding="3"
						cellspacing="1">
						<tr>
							<td align="right" bgcolor="#FFFFFF">
								结算日：
							</td>
							<td bgcolor="#FFFFFF">
								<span class="qzt"> <ad:calendar property="beginDate" path="<%=path%>" /> 
								</span>至
								<span class="qzt"> <ad:calendar property="endDate" path="<%=path%>" /> 
								</span>
								<span class="button_Frame"> <input name="button"
										type="button" class="graybutton_style" onclick="doSearch()"
										value="查 询" /> </span>
							</td>
							<td align="right" bgcolor="#FFFFFF"></td>
							<td bgcolor="#FFFFFF"></td>
						</tr>
						<tr>
							<td colspan="4" align="center" bgcolor="#FFFFFF">

							</td>
						</tr>
					</table>
					<br />
					<table width="100%" class="tablestyle">
						<tr>
							<th>
								<span class="blue14"></span>
							</th>
							<th>
								<span class="blue14">结算起始时间</span>
							</th>
							<th>
								<span class="blue14">结算截至时间</span>
							</th>
							<th>
								<span class="blue14">结算金额</span>
							</th>
							<th>
								<span class="blue14">结算时间</span>
							</th>
						</tr>
						<logic:present name="result" property="data">
							<c:forEach var="trans" items="${result.data}" varStatus="status">
								<tr>
									<td>
										<input type="radio" name="viewDetail"
											value="<bean:write name="trans" property="startDate" format="yyyy-MM-dd HH:mm:ss"/>,<bean:write name="trans" property="endDate" format="yyyy-MM-dd HH:mm:ss"/>"
											style="border:0" />
									</td>
									<td>
										<bean:write name="trans" property="startDate"
											format="yyyy-MM-dd HH:mm:ss" />
									</td>
									<td>
										<bean:write name="trans" property="endDate"
											format="yyyy-MM-dd HH:mm:ss" />
									</td>
									<td>
										<bean:write name="trans" property="amount" />
									</td>
									<td>
										<bean:write name="trans" property="createTime"
											format="yyyy-MM-dd HH:mm:ss" />
									</td>
								</tr>
							</c:forEach>
						</logic:present>
					</table>
					<table width="100%" height="30" border="0" cellpadding="0"
						cellspacing="0">
						<tr>
							<td height="25" align="center" class="font_blue">
								<ad:PageBean name="result" />
							</td>
						</tr>
					</table>
				</html:form>
				<div class="button_Frame">
					<input type="button" class="button_style" value="查看明细"
						onClick="viewTransList();" />
					<input type="button" class="button_style_m" value="下载到XLS列表"
						onclick="doExport();" />
				</div>
			</div>
		</div>
	</div>
</div>
